package com.chenyongjing.design.pattern.iterator.general;

import java.util.List;

/**
 * 具体的迭代器
 * @Author chen
 * @Date 2022/11/19 13:53
 */
public class ConcreteIterator<E> implements Iterator<E> {
    private  List list;
    public ConcreteIterator(List<E> list) {
        this.list=list;
    }

    @Override
    public  E next() {
        return (E) list.iterator().next();
    }

    @Override
    public boolean hasNext() {
        return list.iterator().hasNext();
    }
}
